package com.example.hasee.showinfo;

import com.example.hasee.data.DataCallback;
import com.example.hasee.data.DataStore;
import com.example.hasee.data.entity.School;

import java.util.List;

public class ShowInfoPresenter implements ShowInfoContract.Presenter{
    private ShowInfoContract.View rootView;
    private DataStore mDateStore;
    public ShowInfoPresenter(ShowInfoContract.View rootView) {
        this.rootView = rootView;
        mDateStore=DataStore.getINSTANCE();
    }

    @Override
    public void getInfo() {
        mDateStore.getSchoolList(new DataCallback<List<School>>() {
            @Override
            public void onSuccess(List<School> data) {
                rootView.showSchoolList(data);
            }

            @Override
            public void onFail(String message) {
                rootView.showError(message);
            }
        });
    }
}
